﻿using System;
using System.Collections.Generic;
using System.Windows.Media.Imaging;

namespace Trade.Journal
{
    [Serializable]
    public class Record:IScore,IEquatable<Record>
    {
        public Record()
        {
            GroupId = Id;
        }

        public string Id { get; set; } = Guid.NewGuid().ToString("N");

        public string GroupId { get; set; } 

        public BitmapSource CoverPhoto { get; set; }

        /// <summary>
        /// 合约
        /// </summary>
        public string Contract { get; set; }


        public int Multiplicator { get;  set; }

        /// <summary>
        /// 交易日期
        /// </summary>
        public DateTime Date { get; set; }

        /// <summary>
        /// 版本
        /// </summary>
        public Version Version { get; set; }

        public BarCycle OpportunityCycle { get;  set; }

        public Opportunity Opportunity { get; set; }

        /// <summary>
        /// 保存时间
        /// </summary>
        public DateTime SaveTime { get; set; }

        /// <summary>
        /// 释放
        /// </summary>
        public ReleaseInfo Release { get; set; } 

        /// <summary>
        /// 积累
        /// </summary>
        public CumulationInfo Cumulation { get; set; }  

        /// <summary>
        /// 收益
        /// </summary>
        public double Reveue { get; set; }


        public OpenDeal OpenDeal { get; set; }

        public List<CloseDeal> CloseDeals { get; set; }

        /// <summary>
        /// 疑问
        /// </summary>
        public List<string> Questions { get; set; }

        /// <summary>
        /// 心得
        /// </summary>
        public List<string> Lessons { get; set; }

        /// <summary>
        /// 标签
        /// </summary>
        public List<string> Marks { get; set; }

        public int Score { get; set; }

        public bool Equals(Record other)
        {
            return other != null && Id == other.Id;
        }

        public override int GetHashCode()
        {
            return Id.GetHashCode();
        }
    }

    public interface IScore
    {
        int Score { get; }
    }
}